$(function(){

	////
	option_menu(); //菜单函数

	if (typeof location.search) {
		var value = location.search;

		if (value) {
			var array = value.split('=');
			if(array.length!=4){
				alert('参数传递错误！');
				return false;
			}else{
				var menu_index = array[1].split('&')[0];

				show_menu(menu_index); //显示菜单项
				var category = decodeURI(array[2].split('&')[0]); //获取消息类型
				var id = array[3];

				$('#qian_').html(category);
				$('#qian_').attr('href',"information.html?menu_index="+menu_index+"&category="+category);
				show_information(id); //显示单个消息
			}
		}
	}
});

//显示单个消息函数
function show_information(id){
	$('#right_').html(''); //清空

	$.ajax({
		url : 'getSingleMessage',
		type : "post",
		data : "id=" + id,
		datatype : "json",
		success : function(data) {

			var f='';
			if(data.file.substring(data.file.indexOf('.')+1) == '.rar'){
				f = 'Images/rar.png';
			}else{
				f = 'Images/doc.png';
			}

			var html="<p id='title'>"+data.title+"</p>"+
			"<p id='zh'>关键字:&nbsp;&nbsp;<span id='keywords'>"+data.keywords+
			"</span> <span id='time'>"+formatTime(new Date(data.time))+"</span></p>"+
			"<div id='shuoming'>"+data.memo+"</div>"+
			"<p id='file_p'>"+
			"<span><font size='4' color='blue'>附件:</font> <a href='javascript:void(0);' id='preview_file'>"+
			"<img src="+f+" id='file_image' style='border: none;' />" +
			"<span id='file'>"+data.file+"</span></a></span> " +
			"&nbsp; <a href='uploadFile\\"+data.file+"' id='download'> " +
			"<img alt='' src='Images/down_image.gif' style=‘cursor: poninter; border: none;’ />" +
			"下载</a></p>";

			$('#main').append(html); //显示消息
		},
		error:function(statue){
			alert('获取单个消息失败！');
		}
	});
}
